const login = require("/libs//login");
const verify = require("/libs//verify");
const input = require("/libs/input");
const page = require("/libs/page");
const httpReq = require("/libs//http");
const file = require("/libs/upfile");
const Base64 = require("/libs/base64");
const canvas = require("/libs/canvas");


export = {
    init(){
        console.log("初始加载");
    },
    cloud(env: any) {
        if (!wx.cloud) {
            console.error('请使用 2.2.3 或以上的基础库以使用云能力')
        } else {
            wx.cloud.init({
                env,
                traceUser: true,
            })
        }
    },
    page,
    file,
    user:login, http:httpReq, verify,input,Base64,canvas
}
function test(){
    let str = "物品名称:{{thing1.DATA}}\n到期时间:{{time2.DATA}}\n温馨提示:{{thing3.DATA}}"
    let arr = str.split("\n")
    var jsons:any = []
    for (let i = 0; i < arr.length; i++) {
        const element = arr[i];
        let ar = element.split(":")
        let name = ar[0]
        let key = ar[1]
        jsons = [
            ...jsons,
            {
                name,
                key: key.replace("{{", "").replace(".DATA}}", ""),
                val: ""
            }
        ]
        console.log(name);
        console.log(key.split("{{").join("").split(".DATA}}").join(""));
    }
    console.log(jsons);
}